package com.cg.service.Impl;

import com.cg.entity.Category;
import com.cg.mapper.CategoryMapper;
import com.cg.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoryServicempl implements CategoryService {
    @Autowired
    private CategoryMapper categoryMapper;
    //分类列表
    @Override
    public List<Category> categoryList(Integer userId,String searchName) {
        List<Category>categorys=categoryMapper.categoryList(userId,searchName);
        return categorys;
    }

    @Override
    public void addcategory(String categoryName, Integer userId) {
        categoryMapper.addcategory(categoryName, userId);
    }

    @Override
    public Category findCategoryById(Integer categoryId) {
        return categoryMapper.findCategoryById(categoryId);
    }

    @Override
    public void editcategory(Category category) {
        categoryMapper.editcategory(category);
    }

    @Override
    public void deletecategory(Integer categoryId) {
        categoryMapper.deletecategory(categoryId);
    }

    @Override
    public Category findCategoryByName(String categoryName,Integer userId) {
        return categoryMapper.findCategoryByName(categoryName,userId);
    }

}
